package com.desay.pangoo.itmt.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.desay.pangoo.common.lite.lang.web.CommonResponse;
import com.desay.pangoo.itmt.service.impl.ModifyLogServiceImpl;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

/**
 * 数据集
 *
 * @author uidq1163
 */
@RestController
@Api(tags = "变更日志管理")
@RequestMapping(value = "/log")
@Validated
public class ModifyLogController {
	@Autowired
	private ModifyLogServiceImpl modifyLogService;

	@GetMapping(value = "")
	@ApiOperation(value = "获取工作组分类项目信息列表", notes = "获取工作组分类项目信息列表")
	@ApiImplicitParams({ @ApiImplicitParam(name = "pageNo", type = "int", value = "指定查询页数", paramType = "query"),
			@ApiImplicitParam(name = "pageSize", type = "int", value = "每页数据数量", paramType = "query"),
			@ApiImplicitParam(name = "techPtn", type = "string", value = "技术编号(模糊查询)", paramType = "query"),
			@ApiImplicitParam(name = "id", value = "数据主键ID", type = "int", paramType = "query"),
			@ApiImplicitParam(name = "table", value = "数据库表名称（tech_project_info，key_tech_road_map）", type = "string", paramType = "query") })
	public ResponseEntity<Object> getAllList(@RequestParam(value = "id", required = false) Long id,
			@RequestParam(value = "pageNo", required = true, defaultValue = "1") Integer pageNo,
			@RequestParam(value = "pageSize", required = true, defaultValue = "10") Integer pageSize,
			@RequestParam(value = "table", required = true) String table,
			@RequestParam(value = "techPtn", required = false) String techPtn) {
		return new ResponseEntity<>(
				CommonResponse.success(modifyLogService.getList(pageSize, pageNo, id, table, techPtn)), HttpStatus.OK);
	}
}
